<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Contact extends MY_Controller {
// Some code happens here
    public function __construct()
    {
        parent:: __construct();
        $this->load->helper('html');
		$this->load->helper('text');
        $this->load->library('email');
    }
	
	public function index()
	{
	}
    public function mail()
    {
       $name = stripcslashes($_POST['name']);
	   $emailAddr = stripcslashes($_POST['email']);
	   $comment = stripcslashes($_POST['message']);
	   $subject = stripcslashes($_POST['subject']);	
	   $contactMessage =  
		"Message:
		$comment 

		Name: $name
		E-mail: $emailAddr

		Sending IP:$_SERVER[REMOTE_ADDR]
		Sending Script: $_SERVER[HTTP_HOST]$_SERVER[PHP_SELF]";
        $this->email->from($emailAddr, $name);
        $this->email->to('trongkhoa1103@gmail.com');
        $this->email->subject($subject);
        $this->email->message($contactMessage);
        $this->email->send();
       // echo $this->email->print_debugger();
		echo('success'); //return success callback
    }
    
 }